{include file="header.html"}
<body class="gr">

<div class="navBar">
	<a class="left" href="javascript:history.back()"><i class="return"></i></a>
	<div class="titleView-x">会员权益</div>
</div>

<div class="member-privilege main-padding-top">
	<div class="cate">
		<a href="wap.php?app=member&act=sign"><div class="ico1"></div><span>签到</span><font>签到送积分</font></a>
		<a href="wap.php?app=article&act=detail&id=14"><div class="ico2"></div><span>会员层级</span><font>专享玩法</font></a>
		<a href="wap.php?app=goods&act=enjoy"><div class="ico3"></div><span>折上折</span><font>惊喜优惠</font></a>
		<a href="wap.php?app=article&act=detail&id=15"><div class="ico4"></div><span>生日权益</span><font>专属个人</font></a>
	</div>

	<div class="tip"><i></i>会员活动</div>
	
	<div class="pullRefresh">
		{if count($data)>0}
		<ul class="list ads">
			{foreach from=$data name=g item=g}
			<li ad_type="{$g->ad_type}" ad_content="{$g->ad_content}" pic="{$g->pic}"></li>
			{/foreach}
		</ul>
		{/if}
	</div>
</div>
{include file="footer.html"}
<script>
var offset = $('.pullRefresh .list > li').length;
function createHtml(g){
	var html = '<li ad_type="'+g.ad_type+'" ad_content="'+g.ad_content+'" pic="'+g.pic+'"></li>';
	offset++;
	return html;
}
function resize(){
	$('.ads li').autoHeight(320, 103);
}
$(window).resize(resize);
$(function() {
	resize();
	setAds('.member-privilege .ads li');
	$('.pullRefresh').height($.window().height-($('.member-privilege .tip').offset().top+$('.member-privilege .tip').height()));
	$('.pullRefresh').pullRefresh({
		header : true,
		footer : true,
		footerNoMoreText : '- END -',
		refresh : function(fn){
			var _this = this;
			offset = 0;
			$.getJSON('api.php?app=home&act=privilege_flashes', function(json){
				if(json.error!=0){ $.overloadError(json.msg);return }
				var html = '';
				if($.isArray(json.data))for(var i=0; i<json.data.length; i++)html += createHtml(json.data[i]);
				_this.find('.list').html(html);
				resize();
				setAds('.member-privilege .ads li');
				fn();
			});
		},
		load : function(fn){
			var _this = this;
			$.getJSON('api.php?app=home&act=privilege_flashes', { offset:offset }, function(json){
				if(json.error!=0){ $.overloadError(json.msg);return }
				var html = '';
				if($.isArray(json.data))for(var i=0; i<json.data.length; i++)html += createHtml(json.data[i]);
				_this.find('.list').append(html);
				resize();
				setAds('.member-privilege .ads li');
				fn();
			});
		}
	});
});
</script>